package cn.itcast.order;

import cn.itcast.feign.config.DefaultFeignConfiguration;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

//TODO 开启feign客户端功能
//@EnableFeignClients
//@EnableFeignClients(basePackages = "cn.itcast.order")
//@EnableFeignClients(basePackages = "cn.itcast.order",defaultConfiguration = DefaultFeignConfiguration.class)
@EnableFeignClients(basePackages = "cn.itcast.feign.clients",defaultConfiguration = DefaultFeignConfiguration.class)
@MapperScan("cn.itcast.order.mapper")
@SpringBootApplication
public class OrderApplication {

    public static void main(String[] args) {
        SpringApplication.run(OrderApplication.class, args);
    }

    //将请求客户端RestTemplate交给IOC容器管理
//    @Bean
//    @LoadBalanced
//    public RestTemplate restTemplate() {
//        return new RestTemplate();
//    }

    /*@Bean
    public IRule randomRule(){
        return new RandomRule();
    }*/
}